home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / bin / showexternal (.txt) < prev    next >
Microsoft Windows Help File Content  |  1995-07-02  |  6KB  |  178 lines

  1. # Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
  2. # Permission to use, copy, modify, and distribute this material 
  3. # for any purpose and without fee is hereby granted, provided 
  4. # that the above copyright notice and this permission notice 
  5. # appear in all copies, and that the name of Bellcore not be 
  6. # used in advertising or publicity pertaining to this 
  7. # material without the specific, prior written permission 
  8. # of an authorized representative of Bellcore.  BELLCORE 
  9. # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
  10. # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
  11. # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  12. # Conversion from C shell to Bourne shell by Z-Code Software Corp.
  13. # Conversion Copyright (c) 1992 Z-Code Software Corp.
  14. # Permission to use, copy, modify, and distribute this material
  15. # for any purpose and without fee is hereby granted, provided
  16. # that the above copyright notice and this permission notice
  17. # appear in all copies, and that the name of Z-Code Software not
  18. # be used in advertising or publicity pertaining to this
  19. # material without the specific, prior written permission
  20. # of an authorized representative of Z-Code.  Z-CODE SOFTWARE
  21. # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
  22. # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
  23. # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  24. if test -f /usr/lib/sendmail
  25.     MAILCOMMAND=/usr/lib/sendmail
  26.     MAILCOMMAND=/bin/mail
  27. if test -z "$3"
  28.     echo "Usage: showexternal body-file access-type name [site [directory [mode]]]"
  29.     exit 1
  30. if [ -z "$METAMAIL_TMPDIR" ]
  31.     METAMAIL_TMPDIR=/tmp
  32. bodyfile=$1
  33. atype=`echo $2 | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
  34. name=$3
  35. site=$4
  36. dir=$5
  37. mode=$6
  38. ctype=`grep -i content-type: $bodyfile | sed -e 's/............: //'`
  39. cenc=`grep -i content-transfer-encoding: $bodyfile | sed -e 's/.........................: //'`
  40. username=""
  41. pass=""
  42. TMPDIR=$METAMAIL_TMPDIR/XXXternal.$$
  43. trap 'rmdir "$TMPDIR" >/dev/null 2>&1' 1 2 3 15
  44. mkdir $TMPDIR
  45. cd $TMPDIR
  46. NEWNAME="mm.ext.$$"
  47. NEEDSCONFIRMATION=1
  48. case $atype in
  49.     anon-ftp)
  50.         echo "This mail message contains a POINTER (reference) to data that is "
  51.         echo not included in the message itself.  Rather, the data can be retrieved 
  52.         echo automatically using anonymous FTP to a site on the network. ;;
  53.     ftp)
  54.         echo "This mail message contains a POINTER (reference) to data that is "
  55.         echo not included in the message itself.  Rather, the data can be retrieved 
  56.         echo automatically using the FTP protocol to a site on the network. ;;
  57.     mail-server)
  58.         cat > $METAMAIL_TMPDIR/ext.junk.$$ <<!
  59. This mail message contains a POINTER (reference) to data that is not
  60. included in the message itself.  Rather, the data can be retrieved by
  61. sending a special mail message to a mail server on the network.
  62. However, doing this automatically is slightly dangerous, because
  63. someone might be using this mechanism to cause YOU to send obnoxious
  64. mail.  For that reason, the mail message that WOULD be sent is being
  65. shown to you first for your approval.
  66. This is the message that will be sent if you choose to go ahead and
  67. retrieve the external data:
  68. To: ${name}@${site}:
  69. Subject: Automated Mail Server Request
  70.         cat $bodyfile >> $METAMAIL_TMPDIR/ext.junk.$$
  71.         more $METAMAIL_TMPDIR/ext.junk.$$
  72.         rm $METAMAIL_TMPDIR/ext.junk.$$ ;;
  73.         NEEDSCONFIRMATION=0 ;;
  74. if test $NEEDSCONFIRMATION -ne 0
  75.     echo ""
  76.     echo_n "Do you want to proceed with retrieving the external data? [y] "
  77.     read ANS
  78.     case "$ANS" in
  79.         [Nn]*) rm -rf $TMPDIR; exit 0 ;;
  80.     esac
  81. case "$atype" in
  82.     anon-ftp | ftp)
  83.         case "$atype" in
  84.         anon-ftp )
  85.             username=anonymous
  86.             pass=`whoami`@`hostname`
  87.             ;;
  88.         esac
  89.         if test -z "$site"
  90.         then
  91.             echo_n "Site for ftp access: "
  92.             read site
  93.         if test -z "$username"
  94.         then
  95.             echo_n "User name at site ${site}: "
  96.             read username
  97.         if test -z "$pass"
  98.         then
  99.             echo_n "Password for user $username at site ${site}: "
  100.             stty -echo
  101.             read pass
  102.             stty echo
  103.             echo ""
  104.         if test -z "$dir"
  105.         then
  106.             DIRCMD=""
  107.         else
  108.             DIRCMD="cd $dir"
  109.         if test -z "$mode"
  110.         then
  111.             MODECMD=""
  112.         else
  113.             MODECMD="type $mode"
  114.         echo OBTAINING MESSAGE BODY USING FTP
  115.         echo SITE: $site USER: $username
  116.         ${FTP:-ftp} -n <<!
  117. open $site
  118. user $username $pass
  119. $DIRCMD
  120. $MODECMD
  121. get $name $NEWNAME
  122.         if test ! -r "$NEWNAME"
  123.         then
  124.             echo FTP failed.
  125.             rm -rf $TMPDIR
  126.             exit 1
  127.     afs|local-file)
  128.         if test ! -r $name
  129.         then
  130.             echo File not found
  131.             rm -rf $TMPDIR
  132.             exit 1
  133.         NEWNAME=$name
  134.         echo GETTING BODY FROM FILE NAMED: $NEWNAME ;;
  135.     mail-server)
  136.         if test -z "$bodyfile"
  137.         then
  138.             echo mail-server access-type requires a body file
  139.             rm -rf $TMPDIR
  140.             exit 1
  141.         echo Subject: Automated Mail Server Request > $NEWNAME
  142.         echo To: ${name}@${site} >> $NEWNAME
  143.         echo "" >> $NEWNAME
  144.         cat $bodyfile >> $NEWNAME
  145.         $MAILCOMMAND -t < $NEWNAME
  146.         if test $? -ne 0
  147.         then
  148.             echo sendmail failed
  149.             rm -rf $TMPDIR
  150.             exit 1
  151.         rm -rf $TMPDIR
  152.         echo Your $ctype data has been requested from a mail server.
  153.         exit 0 ;;
  154.         echo UNRECOGNIZED ACCESS-TYPE
  155.         rm -rf $TMPDIR
  156.         exit 1 ;;
  157. if test "$cenc" = base64
  158.     mmencode -u -b < $NEWNAME > OUT
  159.     mv OUT $NEWNAME
  160. elif test "$cenc" = quoted-printable
  161.     mmencode -u -q < $NEWNAME > OUT
  162.     mv OUT $NEWNAME
  163. case "$atype" in
  164.     local-file ) metamail -b -c $ctype $NEWNAME ;;
  165.     * ) metamail -b -c "$ctype" $TMPDIR/$NEWNAME ;;
  166. if test $? -ne 0
  167.     echo metamail failed
  168.     rm -rf $TMPDIR
  169.     exit 1
  170. if test ! "$NEWNAME" = "$name"
  171.     echo ""
  172.     echo The data just displayed is stored in the file $TMPDIR/$NEWNAME
  173.     echo "Do you want to delete it?"
  174.     rm -i $NEWNAME
  175. if test ! -r ${TMPDIR}/${NEWNAME}
  176.     cd /
  177.     rmdir $TMPDIR
  178.